<#import "../tpl/pageTep.ftl" as page>
<@page.pageBase currentMenu="查看活动">
<style>
    .time {
        display: inline-block;
        height: 20px;
        line-height: 20px;
        padding: 4px 12px;
        border: 1px solid #cccccc;
        border-radius: 4px;
        vertical-align: middle;
    }

    /***循环的表单设置***/
    .bui-select .bui-select-input {
        width: 350px;
    }
</style>
<div class="xm-offline">
    <div class="row">
        <div class="panel">
            <div class="panel-header">
                <a href="${basepath}/manage/offline/toList">返回上一级</a>
            </div>
            <div class="panel-body">
                <form id="detailsForm" class="form-horizontal" action=""
                      method="post">
                    <input type="hidden" class="control-text span-width span10" name="id" value="${e.id!}">

                    <div class="control-group">
                        <label class="control-label">
                            <s>*</s>
                            活动名称：
                        </label>

                        <div class="controls">
                            <input type="text" class="control-text span-width span10" name="name" value="${e.name!}"
                                   disabled="disabled">
                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label">
                            <s>*</s>
                            机构名称：
                        </label>

                        <div class="controls">
                            <input type="text" class="control-text span-width span10" name="organizeName"
                                   value="${e.organizeName!}" disabled="disabled">
                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label">
                            <s>*</s>
                            负责人：
                        </label>

                        <div class="controls">
                            <input type="text" class="control-text span-width span10" name="principal"
                                   value="${e.principal!}" disabled="disabled">
                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label">
                            <s>*</s>
                            联系电话：
                        </label>

                        <div class="controls">
                            <input type="text" class="tel control-text span-width span10" name="principalPhone"
                                   value="${e.principalPhone!}" disabled="disabled">
                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label">
                            <s>*</s>
                            活动介绍：
                        </label>

                        <div class="controls control-row12" style="height: 350px;initialFrameWidth: 100%;">
                            <textarea type="text" class="input-large" name="content"
                                      id="content" disabled="disabled">${e.content!}</textarea>
                        </div>
                    </div>

                    <div class="control-group">
                        <label class="control-label">
                            <s>*</s>
                            推送资讯栏：</label>

                        <div class="controls">
                            <input type="text" class="control-text" name="send" value=""
                                   disabled="disabled" id="send"/>
                        </div>
                    </div>

                    <div class="control-group">
                        <label class="control-label">
                            <s>*</s>
                            开始日期：
                        </label>

                        <div class="controls">
                            <input type="text" class="calendar" name="beginTime"
                                   value="${e.beginTime!}" disabled="disabled">
                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label">
                            <s>*</s>
                            结束日期：
                        </label>

                        <div class="controls">
                            <input type="text" class="calendar" name="endTime"
                                   value="${e.endTime!}" disabled="disabled">
                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label">
                            <s>*</s>
                            参与对象：
                        </label>

                        <div class="controls">
                            <input type="text" class="control-text" name="participant" value=""
                                   disabled="disabled" id="participant"/>
                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label">

                            报名条件：
                        </label>

                        <div class="controls">
                            <input type="text" class="control-text span-width span10" name="conditions"
                                   value="${e.conditions!}" disabled="disabled"/>
                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label">
                            <s>*</s>
                            活动类型：</label>

                        <div class="controls">
                            <input type="text" class="control-text" name="type" value=""
                                   disabled="disabled" id="type"/>
                        </div>
                    </div>
                    <div id="donationOffline" style="display: none;">
                        <div class="control-group">
                            <label class="control-label">
                                募捐金额：
                            </label>
                            <div class="controls">
                                <input type="text" class="control-text span-width span10" name="goal"
                                       value="${e.goal!}"  disabled="disabled"/>
                            </div>
                        </div>
                        <div class="control-group">
                            <label class="control-label">
                                <s>*</s>
                                活动二维码：
                            </label>
                            <img src="/${e.qrCode!}" style="height: 100px;width: 100px;margin:0 0 10px 10px"/>
                        </div>
                    </div>

                    <div id="volunteerOffline" style="display: none;">
                        <div class="control-group">
                            <label class="control-label">
                                <s>*</s>
                                所在地区：
                            </label>

                            <div class="controls">
                                <input type="text" class="control-text span-width span2" name="province"
                                       value="${e.province!}" disabled="disabled"/>&nbsp;&nbsp;
                                <input type="text" class="control-text span-width span2" name="city" value="${e.city!}"
                                       disabled="disabled"/>&nbsp;&nbsp;
                                <input type="text" class="control-text span-width span2" name="area" value="${e.area!}"
                                       disabled="disabled"/>&nbsp;&nbsp;
                                <input type="text" class="control-text span-width span10" name="address"
                                       value="${e.address!}" disabled="disabled"/>
                            </div>
                        </div>
                        <div class="control-group">
                            <label class="control-label">
                                <s>*</s>
                                活动时段：
                            </label>

                            <div class="controls">
                                <input type="text" name="beginTimeFrame" value="${e.beginTimeFrame!}"
                                       disabled="disabled">
                                &nbsp;-&nbsp;
                                <input type="text" name="endTimeFrame" class="time" value="${e.endTimeFrame!}"
                                       disabled="disabled">
                            </div>
                        </div>
                        <div class="control-group">
                            <label class="control-label">
                                公益时数：
                            </label>

                            <div class="controls">
                                <input type="text" class="control-text span-width span10" name="serviceTime"
                                       value="${e.serviceTime}"/>
                            </div>
                        </div>
                        <div class="control-group" id="offline-limits">
                            <label class="control-label">
                                参与人数：
                            </label>

                            <div class="controls">
                            </div>
                        </div>
                        <div class="control-group">
                            <label class="control-label">
                                报名人数：
                            </label>

                            <div class="controls">
                                <input type="text" class="control-text span-width span10" name="accountNum"
                                       value="${e.accountNum!}"
                                       disabled="disabled"/>
                            </div>
                        </div>
                        <div class="control-group">
                            <label class="control-label">
                                <s>*</s>
                                活动二维码：
                            </label>
                            <img src="/${e.qrCode!}" style="height: 100px;width: 100px;margin:0 0 10px 10px"/>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>


<script type="text/javascript">
    //ueditor编辑器不可编辑状态
    var editor = UE.getEditor('content', {
        readonly: true
    });
    var Grid = BUI.Grid;
    var Store = BUI.Data.Store;
    var imagesStore = new Store({});
    var editForm = new BUI.Form.Form({
        srcNode: '#detailsForm',
        submitType: 'ajax',
        callback: function (data) {
            if (data.success == true) {
                window.location.href = "${basepath}/manage/offline/toList"
            } else {

            }
        }
    }).render();
    //获取url的type值进行判断，显示相对应值
    function getQueryString(name) {
        var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)', 'i');
        var r = window.location.search.substr(1).match(reg);
        if (r != null) {
            return unescape(r[2]);
        }
        return null;
    }
    var offlineType = getQueryString("type");
    if (offlineType == '1') {
        $("#volunteerOffline").css("display", "block");

    } else {
        $("#donationOffline").css("display", "block");
    }

    //对活动类型做判断塞值到input中
    var type = "${e.type!}";
    if (type == "1") {
        $("#type").val("志愿活动");
    } else {
        $("#type").val("募捐活动");
    }

    //对参与对象做判断塞值到input中
    var participant = "${e.participant!}";
    if (participant == "1") {
        $("#participant").val("所有志愿者");
    } else if (participant == "2") {
        $("#participant").val("仅限内部志愿者");
    } else {
        $("#participant").val("仅限外部志愿者");
    }
    //对是否推送到资讯栏做判断塞值到input中
    var send = "${e.send!}";
    if (send == "y") {
        $("#send").val("是");
    } else {
        $("#send").val("否");
    }
    //参与人数
    var limits = "${e.limits!}";
    var limitsHtml = "";
    if (limits == "0") {
        limitsHtml = '<input type="text" class="control-text span-width span10" name="limits " value="不限" disabled="disabled" />';

    } else {
        limitsHtml = '<input type="text" class="control-text span-width span10" name="limits " value="' + limits + '" disabled="disabled" />';
    }
    document.getElementById("offline-limits").innerHTML += limitsHtml;

</script>

</@page.pageBase>